package com.xbongbong.pro.message.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.pro.enums.smartsettings.enums.AiAssistantPushTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * Description: 消息列表筛选初始化 menu 标签 枚举 saas使用
 * @author 魏荣杰
 * @date 2019/1/7 19:45
 * @version v1.0
 * @since v1.0
 */
@Getter
public enum MessageListSearchFilterMenuTagEnum {
    /**
     * 系统通知 1
     */

    /**
     * ai-assistant 2
     */
    AI_ASSISTANT(MessageGroupTypeEnum.AI_ASSISTANT.getCode(), Collections.singletonList(XbbRefTypeEnum.AI_ASSISTANT.getCode()), Collections.singletonList(XbbRefTypeEnum.AI_ASSISTANT.getCode()), AiAssistantPushTypeEnum.getPushSubCodeListByCode(AiAssistantPushTypeEnum.AI_ASSISTANT_PUSH.getSubCode()), XbbRefTypeEnum.AI_ASSISTANT.getI18nName()),
    /**
     * 工作流 3
     */
    APPROVAL(MessageGroupTypeEnum.WORK_FLOW.getCode(), Collections.singletonList(XbbRefTypeEnum.APPROVAL.getCode()), Collections.singletonList(PushTypeEnum.APPROVAL_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.APPROVAL_PUSH.getCode()), XbbRefTypeEnum.APPROVAL.getI18nName()),

    WORKFLOW_MESSAGE(MessageGroupTypeEnum.WORK_FLOW.getCode(), Collections.singletonList(XbbRefTypeEnum.WORKFLOW_SEND_MESSAGE.getCode()), Collections.singletonList(PushTypeEnum.WORKFLOW_SEND_MESSAGE.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.WORKFLOW_SEND_MESSAGE.getCode()), XbbRefTypeEnum.WORKFLOW_SEND_MESSAGE.getI18nName()),

    /**
     * crm 4
     */
    CUSTOMER(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode()), Collections.singletonList(PushTypeEnum.CUSTOMER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CUSTOMER_PUSH.getCode()), XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getI18nName()),

    CUSTOMER_STAGE(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CUSTOMER_STAGE.getCode()), Collections.singletonList(PushTypeEnum.CUSTOMER_STAGE.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CUSTOMER_STAGE.getCode()), XbbRefTypeEnum.CUSTOMER_STAGE.getI18nName()),

    CUSTOMER_BACK_REMIND(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CUSTOMER_BACK_REMIND.getCode()), Collections.singletonList(PushTypeEnum.CUSTOMER_BACK_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CUSTOMER_BACK_PUSH.getCode()), XbbRefTypeEnum.CUSTOMER_BACK_REMIND.getI18nName()),

    CUSTOMER_TRANSFER_REMIND(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CUSTOMER_TRANSFER_REMIND.getCode()), Collections.singletonList(PushTypeEnum.CUSTOMER_TRANSFER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CUSTOMER_TRANSFER_PUSH.getCode()), XbbRefTypeEnum.CUSTOMER_TRANSFER_REMIND.getI18nName()),

   CUSTOMER_REMIND(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CUSTOMER_REMIND.getCode()), Collections.singletonList(PushTypeEnum.CUSTOMER_REMIND.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CUSTOMER_REMIND.getCode()), XbbRefTypeEnum.CUSTOMER_REMIND.getI18nName()),

    CONTACT(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CONTACT.getCode()), Collections.singletonList(PushTypeEnum.CONTACT_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CONTACT_PUSH.getCode()), XbbRefTypeEnum.CONTACT.getI18nName()),

    COMMUNICATE(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode()), Collections.singletonList(PushTypeEnum.COMMUNICATE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.COMMUNICATE_PUSH.getCode()), XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getI18nName()),

    COMMUNICATE_PLAN(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode()), Collections.singletonList(PushTypeEnum.COMMUNICATE_PLAN_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.COMMUNICATE_PLAN_PUSH.getCode()), XbbRefTypeEnum.COMMUNICATE_PLAN.getI18nName()),

    OPPORTUNITY(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode()), Collections.singletonList(PushTypeEnum.OPPORTUNITY_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.OPPORTUNITY_PUSH.getCode()), XbbRefTypeEnum.SALES_OPPORTUNITY.getI18nName()),

    OPPORTUNITY_STAGE(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.SALE_STAGE.getCode()), Collections.singletonList(PushTypeEnum.OPPORTUNITY_STAGE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.OPPORTUNITY_STAGE_PUSH.getCode()), XbbRefTypeEnum.SALE_STAGE.getI18nName()),

    QUOTATION(MessageGroupTypeEnum.CRM.getCode(),  Collections.singletonList(XbbRefTypeEnum.QUOTATION.getCode()), Collections.singletonList(PushTypeEnum.QUOTATION_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.QUOTATION_PUSH.getCode()), XbbRefTypeEnum.QUOTATION.getI18nName()),

    CONTRACT(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CONTRACT.getCode()), Collections.singletonList(PushTypeEnum.CONTRACT_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CONTRACT_PUSH.getCode()), XbbRefTypeEnum.CONTRACT.getI18nName()),

    CONTRACT_STAGE(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CONTRACT_STAGE.getCode()), Collections.singletonList(PushTypeEnum.CONTRACT_STAGE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CONTRACT_STAGE_PUSH.getCode()), XbbRefTypeEnum.CONTRACT_STAGE.getI18nName()),

    SIGN_IN(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.SIGNIN.getCode()), Collections.singletonList(PushTypeEnum.SIGN_IN_ADD_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.SIGN_IN_ADD_PUSH.getCode()), XbbRefTypeEnum.SIGNIN.getI18nName()),

    WORK_REPORT(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.WORK_REPORT.getCode()), Collections.singletonList(PushTypeEnum.WORK_REPORT_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.WORK_REPORT_PUSH.getCode()), XbbRefTypeEnum.WORK_REPORT.getI18nName()),

    CONTRACT_REMIND(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.CONTRACT_REMIND.getCode()), Collections.singletonList(PushTypeEnum.CONTRACT_REMIND.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CONTRACT_REMIND.getCode()), XbbRefTypeEnum.CONTRACT_REMIND.getI18nName()),

    SALE_REPORT(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.SALES_REPORT_ENTITY.getCode()), Collections.singletonList(PushTypeEnum.SALE_REPORT_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.SALE_REPORT_PUSH.getCode()), XbbRefTypeEnum.SALES_REPORT_ENTITY.getI18nName()),

    QUOTATION_REMIND(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.QUOTATION_REMIND.getCode()), Collections.singletonList(PushTypeEnum.QUOTATION_REMIND.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.QUOTATION_REMIND.getCode()), XbbRefTypeEnum.QUOTATION_REMIND.getI18nName()),

    // 阶段超时提醒
    STAGE_TIMEOUT_REMIND(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.STAGE_TIMEOUT_REMIND.getCode()), Collections.singletonList(PushTypeEnum.STAGE_TIMEOUT_REMIND_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.STAGE_TIMEOUT_REMIND_PUSH.getCode()), XbbRefTypeEnum.STAGE_TIMEOUT_REMIND.getI18nName()),

    PAAS_STAGE(MessageGroupTypeEnum.CRM.getCode(), Collections.singletonList(XbbRefTypeEnum.PAAS_STAGE.getCode()), Collections.singletonList(PushTypeEnum.PAAS_STAGE.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.PAAS_STAGE.getCode()), XbbRefTypeEnum.PAAS_STAGE.getI18nName()),

    /**
     * jxc 5
     */
    SUPPLIER(MessageGroupTypeEnum.JXC.getCode(), Collections.singletonList(XbbRefTypeEnum.SUPPLIER.getCode()), Collections.singletonList(PushTypeEnum.SUPPLIER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.SUPPLIER_PUSH.getCode()), XbbRefTypeEnum.SUPPLIER.getI18nName()),

    PURCHASE(MessageGroupTypeEnum.JXC.getCode(), Collections.singletonList(XbbRefTypeEnum.PURCHASE.getCode()), Collections.singletonList(PushTypeEnum.PURCHASE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.PURCHASE_PUSH.getCode()), XbbRefTypeEnum.PURCHASE.getI18nName()),

    OUTSTOCK(MessageGroupTypeEnum.JXC.getCode(), Collections.singletonList(XbbRefTypeEnum.OUTSTOCK.getCode()), Collections.singletonList(PushTypeEnum.OUTSTOCK_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.OUTSTOCK_PUSH.getCode()), XbbRefTypeEnum.OUTSTOCK.getI18nName()),

    INSTOCK(MessageGroupTypeEnum.JXC.getCode(), Collections.singletonList(XbbRefTypeEnum.INSTOCK.getCode()), Collections.singletonList(PushTypeEnum.INSTOCK_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.INSTOCK_PUSH.getCode()), XbbRefTypeEnum.INSTOCK.getI18nName()),

    BOMBILL(MessageGroupTypeEnum.JXC.getCode(), Collections.singletonList(XbbRefTypeEnum.BOM_BILL.getCode()), Collections.singletonList(PushTypeEnum.BOMBILL_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.BOMBILL_PUSH.getCode()), XbbRefTypeEnum.BOM_BILL.getI18nName()),

    PRODUCTION_ORDER(MessageGroupTypeEnum.JXC.getCode(), Collections.singletonList(XbbRefTypeEnum.PRODUCTION_ORDER.getCode()), Collections.singletonList(PushTypeEnum.PRODUCTION_ORDER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.PRODUCTION_ORDER_PUSH.getCode()), XbbRefTypeEnum.PRODUCTION_ORDER.getI18nName()),

    /**
     * 资金管理6
     */
    PAYMENT(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.PAYMENT.getCode(), XbbRefTypeEnum.PAYMENT_REMIND.getCode(), XbbRefTypeEnum.PAYMENT_OVERDUE.getCode()), Arrays.asList(XbbRefTypeEnum.PAYMENT.getCode(), XbbRefTypeEnum.PAYMENT_REMIND.getCode(), XbbRefTypeEnum.PAYMENT_OVERDUE.getCode()), Collections.singletonList(0), XbbRefTypeEnum.PAYMENT.getI18nName()),

    PAYMENT_SHEET(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), XbbRefTypeEnum.RED_PAYMENT_SHEET.getCode(), XbbRefTypeEnum.BAD_DEBT.getCode(), XbbRefTypeEnum.PREPAYMENT.getCode(), XbbRefTypeEnum.RED_PREPAYMENT.getCode()), Arrays.asList(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), XbbRefTypeEnum.RED_PAYMENT_SHEET.getCode(), XbbRefTypeEnum.BAD_DEBT.getCode(), XbbRefTypeEnum.PREPAYMENT.getCode(), XbbRefTypeEnum.RED_PREPAYMENT.getCode()), Collections.singletonList(0), XbbRefTypeEnum.PAYMENT_SHEET.getI18nName()),

    // TODO 付款计划和付款单还没消息
    INVOICE(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.INVOICE.getCode(), XbbRefTypeEnum.RED_INVOICE.getCode()), Arrays.asList(PushTypeEnum.INVOICE_PUSH.getCode(), PushTypeEnum.INVOICE_RED_ADD_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.INVOICE_PUSH.getCode()), XbbRefTypeEnum.INVOICE.getI18nName()),

    PAY_PLAN(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.PAY_PLAN.getCode(), XbbRefTypeEnum.PAY_PLAN_REMIND.getCode(), XbbRefTypeEnum.PAY_PLAN_OVERDUE.getCode()), Arrays.asList(XbbRefTypeEnum.PAY_PLAN.getCode(), XbbRefTypeEnum.PAY_PLAN_REMIND.getCode(), XbbRefTypeEnum.PAY_PLAN_OVERDUE.getCode()), Collections.singletonList(0), XbbRefTypeEnum.PAY_PLAN.getI18nName()),

    PAY_PLAN_SHEET(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.PAY_SHEET.getCode(),XbbRefTypeEnum.RED_WRITE_OFF_PAY.getCode(), XbbRefTypeEnum.BAD_PAY.getCode(), XbbRefTypeEnum.PREPAY.getCode(), XbbRefTypeEnum.RED_PREPAY.getCode()), Arrays.asList(XbbRefTypeEnum.PAY_SHEET.getCode(), XbbRefTypeEnum.RED_WRITE_OFF_PAY.getCode(), XbbRefTypeEnum.BAD_PAY.getCode(),XbbRefTypeEnum.PREPAY.getCode(), XbbRefTypeEnum.RED_PREPAY.getCode()), Collections.singletonList(0), XbbRefTypeEnum.PAY_SHEET.getI18nName()),

    PURCHASE_INVOICE(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), XbbRefTypeEnum.RED_PURCHASE_INVOICE.getCode()), Arrays.asList(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), XbbRefTypeEnum.RED_PURCHASE_INVOICE.getCode()), Collections.singletonList(0), XbbRefTypeEnum.PURCHASE_INVOICE.getI18nName()),

    CUSTOMER_STATEMENT_STATISTIC(MessageGroupTypeEnum.FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode()), Arrays.asList(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode()), Collections.singletonList(0), XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getI18nName()),
    DISTRIBUTOR_CUSTOMER_STATEMENT_STATISTIC(MessageGroupTypeEnum.DISTRIBUTOR_FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode()), Arrays.asList(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode()), Collections.singletonList(0), XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getI18nName()),
    DISTRIBUTOR_CREDIT_LIMIT(MessageGroupTypeEnum.DISTRIBUTOR_FUND_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.CREDIT_LIMIT.getCode()), Arrays.asList(XbbRefTypeEnum.CREDIT_LIMIT.getCode()), Collections.singletonList(0), XbbRefTypeEnum.CREDIT_LIMIT.getI18nName()),

    /**
     * 工单 7
     */
    WORK_ORDER(MessageGroupTypeEnum.WORK_ORDER.getCode(), Collections.singletonList(XbbRefTypeEnum.WORK_ORDER.getCode()), Collections.singletonList(PushTypeEnum.WORKORDER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.WORKORDER_PUSH.getCode()), XbbRefTypeEnum.WORK_ORDER.getI18nName()),

    /**
     * 市场管理 8
     */
    CLUE(MessageGroupTypeEnum.MARKET_ACTIVITY.getCode(), Collections.singletonList(XbbRefTypeEnum.CLUE.getCode()), Collections.singletonList(PushTypeEnum.CLUE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CLUE_PUSH.getCode()), XbbRefTypeEnum.CLUE.getI18nName()),

    CLUE_STAGE(MessageGroupTypeEnum.MARKET_ACTIVITY.getCode(), Collections.singletonList(XbbRefTypeEnum.CLUE_STAGE.getCode()), Collections.singletonList(PushTypeEnum.CLUE_STAGE.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CLUE_STAGE.getCode()), XbbRefTypeEnum.CLUE_STAGE.getI18nName()),

    CLUE_BACK_REMIND(MessageGroupTypeEnum.MARKET_ACTIVITY.getCode(), Collections.singletonList(XbbRefTypeEnum.CLUE_BACK_REMIND.getCode()), Collections.singletonList(PushTypeEnum.CLUE_BACK_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CLUE_BACK_PUSH.getCode()), XbbRefTypeEnum.CLUE_BACK_REMIND.getI18nName()),

    CLUE_TRANSFER_REMIND(MessageGroupTypeEnum.MARKET_ACTIVITY.getCode(), Collections.singletonList(XbbRefTypeEnum.CLUE_TRANSFER_REMIND.getCode()), Collections.singletonList(PushTypeEnum.CLUE_TRANSFER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.CLUE_TRANSFER_PUSH.getCode()), XbbRefTypeEnum.CLUE_TRANSFER_REMIND.getI18nName()),


    /**
     * 呼叫中心 8
     */

    /**
     * 短信群发 9
     */

    /**
     * 数据中心10
     */
    DATA_CENTER(MessageGroupTypeEnum.DATA_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.DATA_CENTER.getCode()), Collections.singletonList(PushTypeEnum.DATA_CENTER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DATA_CENTER_PUSH.getCode()), XbbRefTypeEnum.DATA_CENTER.getI18nName()),
    DATA_WARNING(MessageGroupTypeEnum.DATA_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.DATA_WARNING.getCode()), Collections.singletonList(PushTypeEnum.DATA_WARNING_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DATA_WARNING_PUSH.getCode()), XbbRefTypeEnum.DATA_WARNING.getI18nName()),

    /**
     * AI销小帮 12
     */
    DATA_IMPORT(MessageGroupTypeEnum.AI_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.DATA_IMPORT.getCode()), Collections.singletonList(PushTypeEnum.DATA_IMPORT.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DATA_IMPORT.getCode()), XbbRefTypeEnum.DATA_IMPORT.getI18nName()),
    TRAIN_MODEL(MessageGroupTypeEnum.AI_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.TRAIN_MODEL.getCode()), Collections.singletonList(PushTypeEnum.TRAIN_MODEL.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.TRAIN_MODEL.getCode()), XbbRefTypeEnum.TRAIN_MODEL.getI18nName()),

    /**
     * 经销商 10
     */
    DISTRIBUTOR(MessageGroupTypeEnum.DISTRIBUTOR.getCode(), Collections.singletonList(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode()), Collections.singletonList(PushTypeEnum.DISTRIBUTOR_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DISTRIBUTOR_PUSH.getCode()), XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getI18nName()),
    DISTRIBUTOR_CONTACT(MessageGroupTypeEnum.DISTRIBUTOR.getCode(), Collections.singletonList(XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getCode()), Collections.singletonList(PushTypeEnum.DISTRIBUTOR_CONTACT_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DISTRIBUTOR_CONTACT_PUSH.getCode()), XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getI18nName()),
    DISTRIBUTOR_COMMUNICATE(MessageGroupTypeEnum.DISTRIBUTOR.getCode(), Collections.singletonList(XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getCode()), Collections.singletonList(PushTypeEnum.DISTRIBUTOR_COMMUNICATE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DISTRIBUTOR_COMMUNICATE_PUSH.getCode()), XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getI18nName()),

    /**
     * 厂商订单中心
     */
    ORDER(MessageGroupTypeEnum.ORDER_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.ORDER.getCode()), Collections.singletonList(PushTypeEnum.ORDER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.ORDER_PUSH.getCode()), XbbRefTypeEnum.ORDER.getI18nName()),
    /**
     * 经销商订单通知
     */
    DISTRIBUTOR_ORDER(MessageGroupTypeEnum.DISTRIBUTOR_ORDER_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.DISTRIBUTOR_ORDER.getCode()), Collections.singletonList(PushTypeEnum.DISTRIBUTOR_ORDER_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DISTRIBUTOR_ORDER_PUSH.getCode()), XbbRefTypeEnum.DISTRIBUTOR_ORDER.getI18nName()),
    DISTRIBUTOR_RETURN(MessageGroupTypeEnum.DISTRIBUTOR_ORDER_CENTER.getCode(), Collections.singletonList(XbbRefTypeEnum.RETURN.getCode()), Collections.singletonList(PushTypeEnum.DISTRIBUTOR_REFUND_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DISTRIBUTOR_REFUND_PUSH.getCode()), XbbRefTypeEnum.RETURN.getI18nName()),

    MARKETING_MANAGEMENT(MessageGroupTypeEnum.MARKETING_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.MARKETING_ACTIVITY_MANAGEMENT.getCode(), XbbRefTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT.getCode()), Arrays.asList(PushTypeEnum.MARKETING_ACTIVITY_MANAGEMENT_ONLINE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.MARKETING_ACTIVITY_MANAGEMENT_PUSH.getCode()), XbbRefTypeEnum.MARKETING_MANAGEMENT.getI18nName()),

    DISTRIBUTOR_MARKETING_MANAGEMENT(MessageGroupTypeEnum.DISTRIBUTOR_MARKETING_MANAGEMENT.getCode(), Arrays.asList(XbbRefTypeEnum.DISTRIBUTOR_COUPON.getCode()), Arrays.asList(PushTypeEnum.DISTRIBUTOR_COUPON_GET_PUSH.getCode(), PushTypeEnum.DISTRIBUTOR_COUPON_USE_PUSH.getCode(), PushTypeEnum.DISTRIBUTOR_PROMOTION_ACTIVITY_MANAGEMENT_ONLINE_PUSH.getCode(), PushTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT_ONLINE_PUSH.getCode()), PushTypeEnum.getPushSubCodeListByCode(PushTypeEnum.DISTRIBUTOR_COUPON_PUSH.getCode()), XbbRefTypeEnum.DISTRIBUTOR_COUPON.getI18nName()),

    //新工单
    WORK_ORDER_V2(MessageGroupTypeEnum.WORK_ORDER_V2.getCode(), Collections.singletonList(XbbRefTypeEnum.WORK_ORDER_V2.getCode()), Collections.singletonList(PushTypeEnum.WORK_ORDER_V2_PUSH.getCode()), WorkOrderV2PushTypeEnum.getPushSubCodeList(), XbbRefTypeEnum.WORK_ORDER_V2.getI18nName()),

    ;

    /**
     * 枚举值
     */
    private Integer id;

    /**
     * 业务实体 code
     */
    private List<Integer> refEntity;

    /**
     * 推送消息类型type
     */
    private List<Integer> type;

    /**
     * 推送消息子类型subType
     */
    private List<Integer> subType;

    /**
     * 消息名称
     */
    private String name;

    MessageListSearchFilterMenuTagEnum(Integer id, List<Integer> refEntity, List<Integer> type, List<Integer> subType, String name) {
        this.id = id;
        this.refEntity = refEntity;
        this.type = type;
        this.subType = subType;
        this.name = name;
    }

    /**
     * Description: 根据id获取相应的refEntity 0 获取全部
     * @param id id
     * @return java.util.List<java.lang.Integer>
     * @author 魏荣杰
     * @date 2019/1/8 14:04
     * @since v1.0
     */
    public static List<Integer> getRefEntityIdsById(Integer id) {
        List<Integer> refEntitys = new ArrayList<>();
        for (MessageListSearchFilterMenuTagEnum cache : values()) {
            if (Objects.equals(id, 0)){
                refEntitys.addAll(cache.getRefEntity());
                continue;
            }
            if (Objects.equals(cache.getId(), id)) {
                refEntitys.addAll(cache.getRefEntity());
            }
        }
        return refEntitys;
    }

    /**
     * Description: 根据id获取相应的消息type
     * @param id id
     * @return java.util.List<java.lang.Integer>
     * @author 魏荣杰
     * @date 2019/1/8 14:04
     * @since v1.0
     */
    public static List<Integer> getTypesById(Integer id) {
        List<Integer> types = new ArrayList<>();
        for (MessageListSearchFilterMenuTagEnum cache : values()) {
            if (Objects.equals(cache.getId(), id)) {
                types.addAll(cache.getType());
            }
        }
        return types;
    }

    /**
     * Description: 根据id获取相应的消息的subType
     * @param id id
     * @return java.util.List<java.lang.Integer>
     * @author 魏荣杰
     * @date 2019/1/8 14:04
     * @since v1.0
     */
    public static List<Integer> getSubTypesById(Integer id) {
        List<Integer> subTypes = new ArrayList<>();
        for (MessageListSearchFilterMenuTagEnum cache : values()) {
            if (Objects.equals(cache.getId(), id)) {
                subTypes.addAll(cache.getSubType());
            }
        }
        return subTypes;
    }

    /**
     * Description: 根据id获取相应枚举
     * @param id id
     * @return java.util.List<com.xbongbong.pro.message.enums.MessageListSearchFilterMenuTagEnum>
     * @author 魏荣杰
     * @date 2019/1/8 14:53
     * @since v1.0
     */
    public static List<MessageListSearchFilterMenuTagEnum> getEnumsById(Integer id) {
        List<MessageListSearchFilterMenuTagEnum> list = new ArrayList<>();
        for (MessageListSearchFilterMenuTagEnum cache : values()) {
            if (Objects.equals(cache.getId(), id)) {
                list.add(cache);
            }
        }
        return list;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
